package cn.itcast.mapper;

import cn.itcast.domain.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
    //查询所有`
     @Select(" select * from user ")
    List<User> findAll();
    //添加用户
     @Insert("insert into user values(id,#{username},#{email})")
    Integer add(@Param("username") String username, @Param("email") String email);
    //根据id删除用户
     @Delete("delete from user where id = #{uid}")
    Integer delete(String uid);
    //根据id查询用户
     @Select("select * from user where id = #{uid}")
    User findById(String uid);
    //修改用户
     @Update("update user set  username= #{username}, email = #{email} where id = #{id}")
    Integer update( @Param("id") int id, @Param("username") String username, @Param("email") String email);
    //批量删除
    Integer deleteByIds(String[] arr);
}
